package com.slz3.business.module.systemManagement.sysRoleMenu;

import com.slz3.business.frame.route.Pattern;
import org.springframework.http.MediaType;
import org.springframework.web.reactive.function.server.RequestPredicate;
import org.springframework.web.reactive.function.server.RouterFunction;
import org.springframework.web.reactive.function.server.ServerResponse;

import static org.springframework.web.reactive.function.server.RequestPredicates.*;
import static org.springframework.web.reactive.function.server.RouterFunctions.route;

public class SysRoleMenuRouter {

    private static RequestPredicate JSON_UTF8 = accept(MediaType.APPLICATION_JSON_UTF8);

    public static RouterFunction<ServerResponse> funs(SysRoleMenuHandler handler) {
        return route(POST(Pattern.ADD).and(JSON_UTF8), handler::add)
                .andRoute(GET(Pattern.INFO), handler::info)
                ;
    }

}
